import { Base } from '../base.js';

class Cart extends Base {
	
	getCount(){
		var params = {
			url: 'v1/cart/count'
		}
		return this.request(params)
	}
	
	getList(ids ='', is_new = 0) {
		var params = {
			url: 'v1/cart/list?ids='+ids+'&is_new='+is_new
		}
		return this.request(params);
	}
	
	add(sku_id, num, props_text, is_new){
		var params = {
			url: 'v1/cart/add',
			type: 'post',
			data: {
				sku_id: sku_id, 
				num: num, 
				props_text: props_text,
				is_new: is_new
			},
		}
		return this.request(params)
	}
	
	update(id, num){
		var params = {
			url: 'v1/cart/update',
			type: 'post',
			data:{id: id, num: num},
		}
		return this.request(params)
	}
	
	delete(id){
		var params = {
			url: 'v1/cart/delete',
			type: 'post',
			data:{id: id},
		}
		return this.request(params)
	}
	
	
	
	clear(cartInfo){
		var params = {
			url: 'v1/cart/clear',
			type: 'post',
			data:{cartInfo: cartInfo},
		}
		return this.request(params)
	}
	
	
};

export { Cart };
